We can now use the async variants instead.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4007>
import * as Params from '../misc/params.js';
import * as Ripples from './ripples.js';
+import {logErrorUnlessCancelled} from '../misc/errorUtils.js';
+
export const STARTUP_ANIMATION_TIME = 500;
export const BACKGROUND_FADE_ANIMATION_TIME = 1000;
}
async _startupAnimationGreeter() {
- await new Promise(resolve => {
- this.panelBox.ease({
- translation_y: 0,
- duration: STARTUP_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: () => resolve(),
- });
- });
+ await this.panelBox.easeAsync({
+ translation_y: 0,
+ duration: STARTUP_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ }).catch(logErrorUnlessCancelled);
}
async _startupAnimationSession() {
if (Main.sessionMode.hasOverview) {
await Main.overview.runStartupAnimation();
} else {
- await new Promise(resolve => {
- this.uiGroup.ease({
- scale_x: 1,
- scale_y: 1,
- opacity: 255,
- duration: STARTUP_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: () => resolve(),
- });
- });
+ await this.uiGroup.easeAsync({
+ scale_x: 1,
+ scale_y: 1,
+ opacity: 255,
+ duration: STARTUP_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ }).catch(logErrorUnlessCancelled);
}
}
import * as Util from '../misc/util.js';
import {formatTimeSpan} from '../misc/dateUtils.js';
+import {logErrorUnlessCancelled} from '../misc/errorUtils.js';
const MAX_NOTIFICATION_BUTTONS = 3;
export const MESSAGE_ANIMATION_TIME = 100;
this.notify('expanded');
this._cover.hide();
- await new Promise((resolve, _) => {
- this.ease_property('@layout.expansion', 1, {
- progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- duration: GROUP_EXPENSION_TIME,
- onComplete: () => resolve(),
- });
- });
+ await this.ease_property_async('@layout.expansion', 1, {
+ progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ duration: GROUP_EXPENSION_TIME,
+ }).catch(logErrorUnlessCancelled);
}
async collapse() {
this._cover.show();
this._updateStackedMessagesFade();
- await new Promise((resolve, _) => {
- this.ease_property('@layout.expansion', 0, {
- progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- duration: GROUP_EXPENSION_TIME,
- onComplete: () => resolve(),
- });
- });
+ await this.ease_property_async_async('@layout.expansion', 0, {
+ progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ duration: GROUP_EXPENSION_TIME,
+ }).catch(logErrorUnlessCancelled);
this._headerBox.hide();
}
const startupPromises = [];
this._stateAdjustment.value = ControlsState.HIDDEN;
- startupPromises.push(new Promise(resolve => {
- this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, {
+ startupPromises.push(
+ this._stateAdjustment.easeAsync(ControlsState.WINDOW_PICKER, {
duration: Overview.ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: resolve,
- });
- }));
+ }));
this.dash.showAppsButton.checked = false;
this._ignoreShowAppsButtonToggle = false;
await this.layout_manager.ensureAllocation();
// Opacity
- startupPromises.push(new Promise(resolve => {
- this.ease({
+ startupPromises.push(
+ this.easeAsync({
opacity: 255,
duration: STARTUP_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: resolve,
- });
- }));
+ }));
// Search bar falls from the ceiling
const {primaryMonitor} = Main.layoutManager;
const yOffset = y - primaryMonitor.y;
this._searchEntryBin.translation_y = -(yOffset + this._searchEntryBin.height);
- startupPromises.push(new Promise(resolve => {
- this._searchEntryBin.ease({
+ startupPromises.push(
+ this._searchEntryBin.easeAsync({
translation_y: 0,
duration: STARTUP_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: resolve,
- });
- }));
+ }));
// The Dash rises from the bottom. This is the last animation to finish,
// so resolve the promise there.
this.dash.translation_y = this.dash.height + this.dash.margin_bottom;
- startupPromises.push(new Promise(resolve => {
- this.dash.ease({
+ startupPromises.push(
+ this.dash.easeAsync({
translation_y: 0,
delay: STARTUP_ANIMATION_TIME,
duration: STARTUP_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onStopped: () => resolve(),
- });
- }));
+ }));
return Promise.allSettled(startupPromises);
}